#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int minimumSum(int n, int k) {
        int res = 0;
        int next = k;
        int s = 1;
        for (int i = 0; i < n; ++i)
        {
            if (s <= k / 2)
                res += s++;
            else
                res += next++;
        }
        return res;
    }
};